//
// Description: 2266. 统计打字方案数
// Created by Loading on 2022/5/16.
//

#include <bits/stdc++.h>

using namespace std;

int countTexts(string pressedKeys) {
    constexpr int MOD = 1e9 + 7;
    int n = pressedKeys.size();
    // 三个字母和四个字母的dp数组，类似斐波那契数列
    vector<long> dp3(n + 1), dp4(n + 1);
    dp3[0] = 1;
    dp4[0] = 1;
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= 3 && j <= i; ++j) {
            dp3[i] = (dp3[i] + dp3[i - j]) % MOD;
        }
        for (int j = 1; j <= 4 && j <= i; ++j) {
            dp4[i] = (dp4[i] + dp4[i - j]) % MOD;
        }
    }

    // 方便写循环代码。末尾增加一个其他字符
    pressedKeys.push_back('#');
    long res = 1;
    // 上一个与当前不同的字符与索引
    char last_c = pressedKeys[0];
    int last_index = 0;
    for (int i = 1; i <= n; ++i) {
        if (pressedKeys[i] != last_c) {
            if (last_c == '7' || last_c == '9') {
                res = res * dp4[i - last_index] % MOD;
            } else {
                res = res * dp3[i - last_index] % MOD;
            }
            last_c = pressedKeys[i];
            last_index = i;
        }
    }

    return (int) res;
}

int main() {
    string pressedKeys = "2222222222222";
    int res = countTexts(pressedKeys);
    cout << res << endl;

    return 0;
}